package com.lancoo.znbkxx.teacher.aibkTestCoach.aibkDialog

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.utils.DensityUtils
import kotlinx.android.synthetic.main.aibk_dialog_question_score_infor.*

class DialogQuesScoreInfor(
        context: Context?,
        val quesScoreInfor: String
) : Dialog(context!!, R.style.CustomDialog2) {
    /**
     * 提交按钮
     */
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.aibk_dialog_question_score_infor)
        window!!.setGravity(Gravity.TOP) //设置弹窗右对齐
        val params = window!!.attributes
        params.y = DensityUtils.dp2px(context, 85f)

        val m: WindowManager = window!!.windowManager
        val d = m.defaultDisplay // 获取屏幕宽、高
        params.width = (d.width-DensityUtils.dp2px(context, 20f)) // 宽度设置为屏幕的0.6

        window!!.attributes = params
        window!!.setWindowAnimations(R.style.MyDialogScale) //设置动画效果

        //按空白处可以取消动画
        setCanceledOnTouchOutside(true)
        //初始化界面数据
        initView()
    }

    private fun initView() {
        TvQuesScoreInfor.text = quesScoreInfor
    }
}